package com.zw.utils;

import java.io.Serializable;
import java.math.BigInteger;

public class PaillierKey implements Serializable {
    // 公钥参数
    public static class PublicKey implements Serializable {
        private final BigInteger n;
        private final BigInteger g;
        private final transient BigInteger nSquared; // 非序列化字段

        public PublicKey(BigInteger n, BigInteger g) {
            this.n = n;
            this.g = g;
            this.nSquared = n.pow(2);
        }

        // Getters
        public BigInteger getN() { return n; }
        public BigInteger getG() { return g; }
        public BigInteger getNSquared() { return nSquared; }
    }

    // 私钥参数
    public static class PrivateKey implements Serializable {
        private final BigInteger lambda;
        private final BigInteger mu;
        private final BigInteger n;

        public PrivateKey(BigInteger lambda, BigInteger mu, BigInteger n) {
            this.lambda = lambda;
            this.mu = mu;
            this.n = n;
        }

        // Getters
        public BigInteger getLambda() { return lambda; }
        public BigInteger getMu() { return mu; }
        public BigInteger getN() { return n; }
    }
}
